<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>添加活动</title>
    <meta name="description" content="Administry - Admin Template by www.865171.cn"/>
    <meta name="keywords" content="Admin,Template"/>
    <link rel="stylesheet" href="/css/jquery.ui.datepicker.css" type="text/css"/>
    <link rel="stylesheet" href="/css/jquery.ui.core.css" type="text/css"/>
    <link rel="stylesheet" href="/css/jquery.ui.theme.css" type="text/css"/>
    <link rel="stylesheet" href="/css/fileuploader.css" type="text/css"/>
    <!-- Favicons -->
    <?php include_once("common/admin_css_js_header.php");?>
    <script src="/js/jquery.ui.datepicker.js"></script>
    <script src="/js/fileuploader.js"></script>
    <script type="text/javascript"
            SRC="<?php echo $view['config']['resource_domain'];?>/js/jquery.wysiwyg.min.js"></script>
    <script type="text/javascript">

        /* sample tags */
        var tags = [
            {tag:"js",freq:30},
            {tag:"jquery",freq:25},
            {tag:"pojo",freq:10},
            {tag:"agile",freq:4},
            {tag:"blog",freq:3},
            {tag:"canvas",freq:8},
            {tag:"dialog",freq:3},
            {tag:"excel",freq:4},
            {tag:"engine",freq:5},
            {tag:"flex",freq:18},
            {tag:"firefox",freq:23},
            {tag:"javascript",freq:40},
            {tag:"graph",freq:15},
            {tag:"grid",freq:20},
            {tag:"hibernate",freq:13},
            {tag:"ical",freq:4},
            {tag:"ldap",freq:9},
            {tag:"load",freq:20},
            {tag:"security",freq:13},
            {tag:"XSS",freq:21},
            {tag:"CSRF",freq:19},
            {tag:"html",freq:22},
            {tag:"xml",freq:13},
            {tag:"tools",freq:21}
        ];

        $(document).ready(function() {

            /* setup navigation, content boxes, etc... */

            $('#description').wysiwyg({
                controls: {
                    strikeThrough : { visible : true },
                    underline     : { visible : true },

                    justifyLeft   : { visible : true },
                    justifyCenter : { visible : true },
                    justifyRight  : { visible : true },
                    justifyFull   : { visible : true },

                    indent  : { visible : true },
                    outdent : { visible : true },

                    subscript   : { visible : true },
                    superscript : { visible : true },

                    undo : { visible : true },
                    redo : { visible : true },

                    insertOrderedList    : { visible : true },
                    insertUnorderedList  : { visible : true },
                    insertHorizontalRule : { visible : true },

                    h4: {
                        visible: true,
                        className: 'h4',
                        command: $.browser.msie ? 'formatBlock' : 'heading',
                        arguments: [$.browser.msie ? '<h4>' : 'h4'],
                        tags: ['h4'],
                        tooltip: 'Header 4'
                    },
                    h5: {
                        visible: true,
                        className: 'h5',
                        command: $.browser.msie ? 'formatBlock' : 'heading',
                        arguments: [$.browser.msie ? '<h5>' : 'h5'],
                        tags: ['h5'],
                        tooltip: 'Header 5'
                    },
                    h6: {
                        visible: true,
                        className: 'h6',
                        command: $.browser.msie ? 'formatBlock' : 'heading',
                        arguments: [$.browser.msie ? '<h6>' : 'h6'],
                        tags: ['h6'],
                        tooltip: 'Header 6'
                    },

                    cut   : { visible : true },
                    copy  : { visible : true },
                    paste : { visible : true },
                    html  : { visible: true }
                }
            });


        });
    </script>
    <script>
        $(function() {
            $("#startDate").datepicker({dateFormat:"yy-mm-dd"});
            $("#endDate").datepicker({dateFormat:"yy-mm-dd"});
            var uploader = new qq.FileUploader({
                // pass the dom node (ex. $(selector)[0] for jQuery users)
                element: document.getElementById('upload'),
                button:null,
                // path to server-side upload script
                action: '<?php echo URL_PREFIX ?>/ajax/upload',
                allowedExtensions: ["jpg", "png", "gif"],
                multiple:true,
// each file size limit in bytes
// this option isn't supported in all browsers

// set to true to output server response to console
                debug: false,
                onProgress: function(id, fileName, loaded, total) {
                },
                onComplete: function(id, fileName, responseJSON) {
                    $("#picture").val(responseJSON.url);
                    $("#upload").text("已成功上传");
                    return false;
                },
                onCancel: function(id, fileName) {
                },

                messages: {
                    // error messages, see qq.FileUploaderBasic for content
                }
            });
        });
    </script>
</head>
<body>
<?php include_once("common/admin_header.php");?>
<!-- Page title -->
<div id="pagetitle">
    <div class="wrapper">
        <h1>活动管理 &rarr; <span>添加活动</span></h1>
        <!-- Quick search box -->
        <form action="" method="get"><input class="" type="text" id="q" name="q"/></form>
    </div>
</div>
<!-- End of Page title -->

<!-- Page content -->
<div id="page">
    <!-- Wrapper -->
    <div class="wrapper">
        <!-- Left column/section -->
        <section class="column width6 first">
            <?php include_once("common/formOperationResult.php");?>

            <h3>添加活动</h3>

            <form id="sampleform" method="post" action="<?php echo URL_PREFIX ?>/Admin/activities?action=save">
                <?php if (isset($view['activity'])) {
                echo "<input type='hidden' name = 'activityId' value='" . $view['activity']['activityId'] . "' />";
            } ?>
                <fieldset>
                    <legend>News info</legend>

                    <p>
                        <label class="required" for="producttitle">标题</label><br/>
                        <input type="text" name="title" class="half title"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['title'];
                               } ?>" name="title"/>
                        <small>请输入活动标题</small>
                    </p>

                    <p>
                        <label class="required" for="producttitle">海报图片</label><br/>
                        <input type="text" id="picture" class="half title" name="picture"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['picture'];
                               } ?>" name="title"/>

                    <div id="upload">上传文件</div>
                    </p>

                    <p>
                        <label for="productdesc">简介</label><br/>
                        <textarea id="description" class="large full" name="description">
                            <?php if (isset($view['activity'])) {
                            echo $view['activity']['description'];
                        } ?>
                        </textarea>
                    </p>

                    <p>
                        <label class="required" for="producttitle">活动开始时间</label><br/>
                        <input type="text" id="startDate" name="startDate" class="half title"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['startDate'];
                               } ?>"/>
                    </p>

                    <p>
                        <label class="required" for="producttitle">活动结束时间</label><br/>
                        <input type="text" id="endDate" name="endDate" class="half title"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['endDate'];
                               } ?>"/>
                    </p>

                    <p>
                        <label class="required" for="producttitle">活动地点</label><br/>
                        <input type="text" name="address" class="full title"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['address'];
                               } ?>"/>
                    </p>

                    <p>
                        <label class="required" for="producttitle">联系电话</label><br/>
                        <input type="text" id="tel" name="tel" class="half title"
                               value="<?php if (isset($view['activity'])) {
                                   echo $view['activity']['tel'];
                               } ?>"/>
                    </p>

                    <P>
                        <label class="required" for="producttitle">期限</label><br/>
                        <select id="phases" name="phases">
                            <option <?php if (isset($view['activity']) && $view['activity']['phases'] == 'EXPIRED') echo "selected";  ?>
                                    value="EXPIRED">过期
                            </option>
                            <option <?php if (isset($view['activity']) && $view['activity']['phases'] == 'NOW') echo "selected";  ?>
                                    value="NOW">本期
                            </option>
                            <option <?php if (isset($view['activity']) && $view['activity']['phases'] == 'LATER') echo "selected";  ?>
                                    value="LATER">下期
                            </option>
                        </select>
                    </P>


                    <p class="box"><input type="submit" class="btn btn-green big" value="Save"/> or <a
                            href="#">Cancel</a></p>

                </fieldset>

            </form>

        </section>
        <!-- End of Left column/section -->

        <!-- Right column/section -->
        <!-- <aside class="column width2">
            <p><a href="#" class="btn btn-special btn-green"><img SRC="../img/page_white_go.png" class="icon" alt=""/>Preview
                Product</a></p>

            <p><a href="#" class="btn btn-special"><img SRC="../img/page_save.png" class="icon" alt=""/>Save Draft</a>
            </p>

            <div class="content-box">
                <header>
                    <h3>Product Visibility</h3>
                </header>
                <section>
                    Choose whether or not you want this product to be publicly visible.
                    <p>
                        <select id="visibility" class="full" name="visibility">
                            <option value="1" selected>published</option>
                            <option value="2">draft</option>
                        </select>
                    </p>
                </section>
            </div>
            <div class="content-box">
                <header>
                    <h3>Product Tags</h3>
                </header>
                <section>
                    Enter any number of tags separated by space.
                    <p><textarea id="tags" class="small full" name="tags"></textarea></p>
                </section>
            </div>
            <div id="rightmenu">
                <dl class="first">
                    <dt><img width="16" height="16" alt="" SRC="../img/help.png"></dt>
                    <dd><a href="#">Help</a></dd>
                    <dd class="last">If you are a new user, you should read "Getting started"</dd>
                </dl>
            </div>
        </aside>-->
        <!-- End of Right column/section -->

    </div>
    <!-- End of Wrapper -->
</div>
<!-- End of Page content -->

<?php include_once("common/admin_footer.php");?>
</body>
</html>